#pragma once

#include "AriaVG.h"
#include "A2DDevice.h"

class A2DImage : public A2DSubscriber<A2DImage>
{
public:
	A2DImage(A2DDevice &device);

	bool LoadFromFile(LPCWSTR fileName);
	bool LoadFromMemory(LPVOID data, DWORD size);
private:
	bool CreateTexture(UINT width, UINT height);
	bool Lock(LPBYTE &buffer, int &pitch);
	void Unlock(void);

	bool A2DImage::LoadAsJPEG(LPVOID data, DWORD size);
private:
	CComPtr<IDirect3DTexture9> m_d3dTex;
	CSize m_size;
	CSize m_texSize;
};